//
//  MYouHuiCell.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/4/14.
//  Copyright © 2017年 金橙云. All rights reserved.
//




#define O_WIDTH [UIScreen mainScreen].bounds.size.width
#import "MYouHuiCell.h"

@implementation MYouHuiCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        
        NSInteger a = 70;
        NSInteger b = (O_WIDTH-15*2-a*4)/3;
        _dayLab = [[UILabel alloc] init];
        _dayLab.textColor = [UIColor blackColor];
        _dayLab.textAlignment = NSTextAlignmentCenter;
        _dayLab.font = [UIFont systemFontOfSize:12];
        _dayLab.text= @"2016-12-30";
        [self addSubview:_dayLab];
        [_dayLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(a, 20));
            make.left.equalTo(self.mas_left).offset(15);
            make.top.equalTo(self.mas_top).offset(8);
            
        }];
        
        _nameLab = [[UILabel alloc] init];
        _nameLab.textColor = [UIColor blackColor];
        _nameLab.font = [UIFont systemFontOfSize:12];
        _nameLab.text= @"李芳芳";
        _nameLab.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_nameLab];
        [_nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(a, 20));
            make.left.equalTo(_dayLab.mas_right).offset(b);
            make.top.equalTo(self.mas_top).offset(8);
            
        }];
        
        
        _houseLab = [[UILabel alloc] init];
        _houseLab.textColor = [UIColor blackColor];
        _houseLab.font = [UIFont systemFontOfSize:12];
        _houseLab.textAlignment = NSTextAlignmentCenter;
        _houseLab.text= @"1号楼2单元2209房";
        [self addSubview:_houseLab];
        [_houseLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(115, 20));
            make.left.equalTo(_nameLab.mas_right).offset(0);
           
            make.top.equalTo(self.mas_top).offset(8);
            
        }];
        
        _shenLab = [[UILabel alloc] init];
        //_shenLab.textColor = [UIColor orangeColor];
        _shenLab.font = [UIFont systemFontOfSize:12];
        _shenLab.textAlignment =  NSTextAlignmentRight;
        _shenLab.text= @"待审批";
        [self addSubview:_shenLab];
        [_shenLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(a, 20));
            make.right.equalTo(self.mas_right).offset(-5);
            make.top.equalTo(self.mas_top).offset(8);
            
        }];

        
        
        
        
    }
    return self;
}

-(void)setManagerYouHuiWithDayString:(NSString *)_day withNameString:(NSString *)_name withHouseString:(NSString *)_house withShenString:(NSString *)_shen withShenLable:(NSString *)_shenL
{
    
    _dayLab.text = _day;
    _nameLab.text = _name;
    _houseLab.text = _house;
    if ([_shen isEqualToString:@"1"])
    {
       
       _shenLab.text = _shenL;
        _shenLab.textColor = [UIColor blackColor];
        
    }
    if ([_shen isEqualToString:@"2"])
    {
        _shenLab.text = _shenL;
        _shenLab.textColor = [UIColor colorWithHexString:@"#006400"];
    }
    if ([_shen isEqualToString:@"3"])
    {
        _shenLab.text = _shenL;
        _shenLab.textColor = [UIColor redColor];
    }
    
    
    
    
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
